package com.suyl.annotationdemo.core.annotation;

import com.suyl.annotationdemo.core.validator.Validator;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * @author : suyl
 * @version : v1.0.0
 * @date : 2020/3/20 15:02
 * @descr : 定义Person注解
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface Person {

    // 姓名默认suyl
    String name() default "suyl";

    // 年龄默认29
    int age() default 29;

    // 自定义验证规则
    Class<? extends Validator> validator() default Void.class;

    class Void implements Validator {
        @Override
        public String valid(Object value) {
            return null;
        }
    }
}
